<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>{block name="title"}金夫人玛瑞莎业务系统{/block}</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="__CSS__/bootstrap.min.css">
    <link rel="stylesheet" href="__CSS__/AdminLTE.min.css">
    <script type="text/javascript" src="__JS__/jquery-2.2.3.min.js"></script>
    <style>
        .wrapper {
            padding: 15px;
        }
        .wrapper::after {
            clear: both;
            display: block;
            content: '';
            margin-bottom: 30px;
        }
        .panel {
            border: none;
        }
        .panel-heading {
            border-bottom: 1px dotted rgba(0, 0, 0, 0.2);
            padding: 15px;
            text-transform: uppercase;
            color: #535351;
            font-size: 16px;
            font-weight: bold;
        }
    </style>
</head>
<body >
<!--body wrapper start-->
<div class="wrapper">
    <div class="row">

        <div class="col-lg-12">
            <section class="panel">
                <header class="panel-heading">
                    新增类别
                </header>
                <div class="panel-body">
                    <div class=" form">
                        <form class="cmxform form-horizontal adminex-form" id="commentForm" method="post" action="{:url('add')}">
                            <div class="form-group ">
                                <label  class="control-label col-xs-4">课程：</label>
                                <input class="form-control"  name="id" type="hidden" value="{$info.id}" required />
                                <div class="col-xs-5">
                                    <select class="form-control" name="kecheng" disabled="disabled" >
                                        <option value="">请选择课程</option>
                                        {volist name="kecheng" id="data"}
                                        <option value="{$data.id}"  {eq name="info['kecheng']" value="$data.id"} selected="selected" {/eq}>{$data.name}</option>
                                        {/volist}
                                    </select>
                                </div>
                            </div>
                            <div class="form-group ">
                                <label class="control-label col-xs-4">时间：</label>
                                <div class="col-xs-5">
                                    <input class="form-control"  name="time" type="text" value="{$info.time}" required disabled="disabled" />
                                </div>
                            </div>
                            <div class="form-group ">
                                <label class="control-label col-xs-4">医院名称：</label>
                                <div class="col-xs-5">
                                    <select class="form-control" name="yiyuan" disabled="disabled">
                                        <option value="">请选择医院</option>
                                        {volist name="yiyuan" id="data"}
                                        <option value="{$data.id}"  {eq name="info['yiyuan']" value="$data.id"} selected="selected" {/eq}>{$data.name}</option>
                                        {/volist}
                                    </select>
                                </div>
                            </div>
                            <div class="form-group ">
                                <label class="control-label col-xs-4" id="address">地址：</label>
                                <div class="col-xs-5">
                                    <textarea class="form-control"  name="tkdz" value="{$info.tkdz}">{$info.tkdz}</textarea>
                                </div>
                            </div>
                            <div class="form-group ">
                                <label class="control-label col-xs-4">电话：</label>
                                <div class="col-xs-5">
                                    <input class="form-control"  name="bmdh" type="bmdh" value="{$info.bmdh}" required disabled="disabled" />
                                </div>
                            </div>

                            <!-- 类别ID -->

                            <div class="form-group">
                                <div class="col-lg-offset-2 col-xs-10">
                                    <button class="btn btn-default" type="button" id="exit">取消</button>
                                </div>
                            </div>
                        </form>
                    </div>

                </div>
            </section>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="__STATIC__/layer/layer.js"></script>
<script>
    $('#submit').click(function () {
        $.ajax({
            type: "POST",
            url:  "{:url('edit')}",
            data: $('#commentForm').serialize(),
            beforeSend:function(){
                $(this).attr("disabled","false"); //禁止点击
            },
            success: function(info){
                //console.log(info);
                if(info.status==1){
                    layer.msg(info.msg, {icon: 1});
                    setTimeout(function(){
//                        location.href=info.url;
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index); //再执行关闭
                    },3000); //延迟演示
                }else{
                    layer.msg(info.msg, {icon: 5});
                    $('#submit').removeAttr("disabled"); //禁止点击
                }

            }
        });
        return false;
    });
    $('#exit').click(function () {
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index); //再执行关闭
    });
</script>

